<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/interno.xhtml">
	<ui:define name="corpo">
		<h:form>
			<p:commandButton value="Novo Cliente" action="clienteNovo"
				title="Cadastrar novo Cliente" />
			<br />
		</h:form>
		<br />
		<h:form>
			<h:inputHidden value="#{clienteBean.cliente.codigo}" />
			<p:dataTable value="#{clienteBean.lista}" var="cli"
				widgetVar="tabelaCliente" emptyMessage="Nenhum Cliente Cadastrado"
				border="1" paginator="true" rows="10">

				<f:facet name="header">
					<p:outputPanel>
						<p:inputText id="globalFilter" onkeyup="tabelaCliente.filter()"
							style="width:350px" title="Pesquisar Cliente" />
						<p:watermark for="globalFilter"
							value="Digite aqui para pesquisar Cliente" />
					</p:outputPanel>
				</f:facet>

				<p:column filterBy="#{cli.nomeRsocial}" filterStyle="display:none">
					<f:facet name="header">Nome/Razão Social</f:facet>
					<h:outputText value="#{cli.nomeRsocial}" style="font-size:12px" />
				</p:column>

				<p:column filterBy="#{cli.cnpjCpf}" filterStyle="display:none">
					<f:facet name="header">Cpf/Cnpj</f:facet>
					<h:outputText value="#{cli.cnpjCpf}" style="font-size:12px" />
				</p:column>

				<p:column filterBy="#{cli.telefone}" filterStyle="display:none">
					<f:facet name="header">Telefone</f:facet>
					<h:outputText value="#{cli.telefone}" style="font-size:12px" />
				</p:column>

				<p:column filterBy="#{cli.email}" filterStyle="display:none"
					style="width:100px">
					<f:facet name="header">E-mail</f:facet>
					<a href="mailto:#{cli.email}" title="Enviar email para cliente"
						style="font-size: 12px">#{cli.email}</a>
				</p:column>

				<p:column style="width:10px">
					<h:commandLink action="clienteVisualizar">
						<h:graphicImage library="imagens" name="visualizar.png"
							style="border:0" title="Visualizar Cliente" />
						<f:setPropertyActionListener target="#{clienteBean.cliente}"
							value="#{cli}" />
					</h:commandLink>
				</p:column>

				<p:column style="width:10px">
					<h:commandLink action="#{clienteBean.editar}">
						<h:graphicImage library="imagens" name="editar.png"
							style="border:0" title="Alterar Cliente" />
						<f:setPropertyActionListener target="#{clienteBean.cliente}"
							value="#{cli}" />
					</h:commandLink>
				</p:column>

				<p:column style="width:10px">
					<h:commandLink action="#{clienteBean.deletarCliente}"
						onclick="if(!confirm('Confirma a exclusão do cliente #{cli.nomeRsocial} ? ')) return false;">

						<h:graphicImage library="imagens" name="excluir.png"
							style="border:0" title="Excluir Cliente" />
						<f:setPropertyActionListener target="#{clienteBean.cliente}"
							value="#{cli}" />
					</h:commandLink>
				</p:column>


			</p:dataTable>

		</h:form>

	</ui:define>

</ui:composition>
</html>
